<template>
  <div>
    <h1>审核</h1>
    <ul v-for="i in shendata" :key="i">
      <li>
        {{ i.content }} <button @click="tong(i.id)">通过</button>
        <button @click="notong(i.id)">不通过</button>
        <van-fields laber="留言"/>
      </li>
    </ul>
  </div>
</template>

<script>
import axios from "axios";
export default {
  name: "xiaoshenhe",
  data() {
    return {
      userid: 1,
      shendata: "",
      liudata:"",
    };
  },
  methods: {
    getdata() {
      axios({ url: "http://127.0.0.1:5000/shenhecontent", method: "get" }).then(
        (res) => {
          console.log(res);
          this.shendata = res.data.list;
        }
      );
    },
    tong(id) {
      axios({
        url: " http://127.0.0.1:5000/tongshenhe",
        method: "post",
        data: { userid: this.userid, leaveword: this.liudata, zuopin_id: id },
      }).then((res) => {
        console.log(res);
      });
    },
    notong(id) {
      axios({
        url: "http://127.0.0.1:5000/notongshenhe",
        method: "post",
        data: { userid: this.userid, leaveword: this.liudata, zuopin_id: id },
      }).then((res) => {
        console.log(res);
      });
    },
  },
  mounted() {
    this.getdata();
  },
};
</script>

<style scoped></style>
